import React from "react";
import { Button, ButtonProps } from 'antd';
import { UserOutlined } from '@ant-design/icons';

import { withModal, mountModal } from "@yaf/pro-ui";

import InitAdmin from "./InitAdmin";

interface InitAdminBtnProps extends ButtonProps {
  accountId: number;
}

const InitAdminBtn: React.FC<InitAdminBtnProps> = ({ accountId, size = "small", ...buttonProps }) => {

  return <Button
    icon={<UserOutlined />}
    onClick={() => {
      const InitAdminModal = withModal(InitAdmin);
      mountModal(<InitAdminModal
        modalProps={{
          title: "初始化管理员",
          width: "40%",
        }}
        accountId={accountId}
      />);
    }}
    {...buttonProps}
  >初始化管理员</Button>
}

export default InitAdminBtn;
